var app = getApp();
Page({
  data: {
    
  },
  onLoad: function (e) {
    var that = this;
    var title = e.title?e.title:'我的钱包';
    that.setData({
      title:title
    })
    console.log(title)
    app.setNavtitle(title);
  },
  onShow: function () {
    if(this.data.title){
      app.setNavtitle(this.data.title);
    }
    this.requestMemberInfo();
  },
  requestMemberInfo: function () {
    var that = this;
    //发起请求，获取列表列表
    if (!that.data.userInfo){
      wx.showLoading({
        title: '加载中',
      })
    }
    wx.request({
      url: app.globalData.requestUrl,
      data: {
        map: 'applet_member_info'
      },
      success: function (res) {
        console.log(res.data);
        if (res.data.ec == 200) {
          console.log(res.data.data);
          that.setData({
            userInfo: res.data.data
          })
        } else {
          console.log(res.data)
          app.errorTip(that, res.data.em, 2000);
        }
      },
      complete: function () {
        wx.hideLoading();
      }
    });
  },
  // 余额充值
  towalletRecharge: function () {
    wx.navigateTo({
      url: '/subpages/walletRecharge/walletRecharge'
    })
  },
  // 余额明细
  torechargeRecords: function () {
    wx.navigateTo({
      url: '/subpages/rechargeRecords/rechargeRecords'
    })
  },
  // 账密充值
  toSecretRecharge(){
    wx.navigateTo({
      url: '/subpages/secretRecharge/secretRecharge'
    })
  }
})